package com.geekaca.test;

import org.junit.*;

public class HelloJunit {

    @BeforeClass
    public static void beforeClass(){
        System.out.println("==========beforeClass 方法执行一次=============");
    }

    @AfterClass
    public static void afterClass(){
        System.out.println("===========afterClass 方法执行一次===================");
    }

    @Before
    public void testBefore(){
        System.out.println("before执行---------");
    }

    @After
    public void testAfter(){
        System.out.println("After执行---------");
    }

    @Test
    public void testLogin() {
        UserService userService = new UserService();
        boolean isOk = userService.isLoginOk("admin", "123456");
        System.out.println("  测试 testLogin...");
        Assert.assertTrue("登录测试失败", isOk);

    }

    @Test
    public void testGetName(){
        UserService userService = new UserService();
        String uname = userService.getUsername("U009");
        System.out.println("  测试 testGetName");

        Assert.assertEquals("用户ID不正确","Tom","Tom");
    }
}
